home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 128 25
/
q25.d81
/
t.megabasic 2
< prev
next >
Wrap
Text File
|
2022-08-28
|
11KB
|
284 lines
M E G a B a s i c
by e. g. bell
The following is a continuation of the documentation for MEGaBasic began
in "t.megabasic 1".
*** Quit
QUIT disables MEGaBasic.
*** Read
READ allows you to view a sequential type file from disk without
disturbing the program you have in memory. The format for the READ command
is:
read "filename" <,u#>
Ex:
read "Top Secret",u9
or read "Top Secret"
*** Resave
If you have been using Commodore computers and disk drives for a long
enough period of time, you no doubt remember the great save with replace
controversy. It was finally proven to be caused by a bug in the 1541 and
1571 drive ROMs, carried over from their dual-drive ancestors. Supposedly
the 1571 was fixed and the 1581 never suffered the bug. However, some of us
who got bitten by the bug stopped trusting the SAVE "@0:" form of the save
command. It was just as effective, and much safer, to delete the file first
then save it. That is what RESAVE does. It deletes the file first, then
does a normal save. The format of the command is:
resave "filename" <,u#>
Ex:
resave "version02",u9
or resave "version02"
*** Old
This is a simple way to restore a program that you have accidentally
'NEW'ed. This is a common utility, sometimes called UNNEW.
*** Move
You are going to love this one! MOVE allows you to move blocks of lines
from one location to another in your BASIC program files. It is very handy
when structuring your programs for efficient order and operation. For
example, due to the way GOSUB operates, it is faster to have your
subroutines located at the start of your BASIC program in most cases. The
format of the MOVE command is:
move, from-line, to-line, target-line
The from-line is the first line of the block to be moved. The to-line is
the last line of that block. The target-line is the line after which you
want to move the block.
Ex:
move,100,500,20
moves lines 100 through 500 inclusive to follow line 20.
or move,100,500,1000
moves lines 100 through 500 inclusive to follow line 1000.
All three parameters are required. NOTE! The comma immediately after the
MOVE command is necessary. You cannot MOVE a block of lines to a target
line within itself, and finally, the from-line must be less than or equal to
the to-line.
MOVE does not change line numbers. It just dutifully moves the
specified block from here to there. When it is done, you will get a message
that 'You MUST RENUMBER or RESequence NOW!'. Don't ignore this. Do it
immediately. It will cause problems if you don't do it.
You might be wondering right now what this MOVE does to the gosub and
goto references in your program. The answer is that if you follow all
directions -- namely renumbering the program after the MOVE -- there is no
effect at all. All line references will be correctly renumbered, including
any within or to the block of lines that were moved.
*** Combine
Merge is a very handy utility, but in larger programs it tends to be
slow because each new line has to be spliced in, and room has to be made for
each line. COMBINE is a much quicker alternative. COMBINE could also have
been called APPEND, which is what it does. It simply APPENDs the desired
file from disk to the end of the program in memory. The syntax is:
combine "filename" <,u#>
Ex:
combine "newlines",u9
or combine "newlines"
Line numbers are not changed in either program. The reason this command was
added was primarily for editing of BASIC format machine language source
files, where line references are not used for program execution. If you use
an assembler like EGads or PAL that use BASIC format source files, you will
find this utility most useful.
If you use COMBINE with BASIC programs, either make sure the program you
are combining has a unique set of line numbers, or that there are no
references (i.e. GOTO, GOSUB, THEN, etc.) to lines with the same numbers in
both programs. The first occurrence of a line number in a program is the
one to which *ALL* such references will be directed when you RENUMBER your
program. This could be disastrous.
COMBINE is a great utility for starting a new program using a library of
routines as a foundation.
*** Lsave
This command is probably my favorite of all the ones available. I have
never seen it on a Commodore utility, though it is so useful I don't know
how I ever got along without it. What it allows you to do is save a range
of lines of the current program in memory to disk in a named file. Just
wait to see how easy it is to start building your library of best-loved
routines using LSAVE. The format of the LSAVE command is:
lsave "filename" <,u#><,from-line><,to-line>
If you want the save to go to the currently specified device, you don't
have to use the ,u# parameter, but you must still account for it. Just use
the comma with no entry, then a second comma followed by the from-line
entry.
Ex:
lsave "directory.rtn",,100,300
saves a file consisting of lines 100 through 300 inclusive of the program
in memory to a file called 'directory.rtn' on the current drive.
lsave "directory.rtn",u8,100
saves a file consisting of lines 100 through the end of the program in
memory to a file called 'directory.rtn' on drive 8.
*** Start
This function allows you to display the load address of the specified
file on disk. The syntax is:
start "filename" <,u#>
MEGaBasic returns the load address of 'filename'.
*** Compare
This utility is kind of interesting. On occasion I work with other
programmers on machine language projects. This is rather hard to
coordinate. You have two people changing a program source file or files at
the same time. Who ever knows what the other guy did? You have to know
that in order to make sure all the changes are in the final copy. COMPARE
started life as a BASIC/ML utility that did this job. It has been
assimilated into MEGaBasic, but performs the same job. Note that COMPARE
only works with BASIC format files.
The format of the COMPARE command is:
compare "file1" <,u#> ["file2" or "*"] <,u#> [<,p#> or <,"log"><,u#>]
First, let me try to explain what COMPARE does. COMPARE works by pulling
both copies, 'file1' and 'file2', into memory, then comparing them line by
line. Differences are reported to your specified medium, which I'll discuss
shortly. COMPARE does two passes, comparing file 1 to file 2, then file 2
to file 1. This is because lines could have been added and/or deleted, and
this is the only way to make sure they are all accounted for. Some
duplication in the report is possible due to the two passes.
It is important to note that COMPARE will only give you a usable report
if you have not renumbered either of the files. If you renumber the files,
there is little chance of getting a valid comparison because most if not all
of the lines are going to be reported as different. I recommend renumbering
your programs by 20 or 30 before editing. That gives you plenty of room
between lines for edits without having to renumber.
Now, let's break the command format down into smaller pieces to better
understand that dizzying collection of characters.
compare "file1" <,u#> ["file2" <,u#> or "*"] [<,p#> or <,"log"><,u#>]
-------------
"file1" is the first file parameter to compare. Think of this as the file
you want to compare something to. This file ends up in RAM 1 after the
comparison operation. It is not the file you will be working with, nor will
it be available in RAM 0 memory for editing after the compare. It is the
'constant' in the comparison.
Note the <,u#> argument. This is the same drive specifier discussed
earlier in this document. It is not necessary to include it, and you don't
need the comma if you don't specify the drive.
compare "file1" <,u#> ["file2" <,u#> or "*"] [<,p#> or <,"log"><,u#>]
--------------------
The second parameter has two possible forms, one of which MUST be used. If
you want to compare a file on disk to "file1